﻿using Modelado.Modulos.ClasesModelado;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AccesoDatos.Modulos.ClasesAccesoDatos
{
    public class AD_REP_FACTURACION_BY_ORDEN
    {
        public DataTable SEL_FACTURACIONByORDEN(SqlCommand comando, int codorden)
        {
            try
            {
                string sp = "SP_SEL_FACTURACIONByORDEN";

                comando.CommandType = CommandType.StoredProcedure;
                comando.CommandText = sp;
                comando.Parameters.Clear();

                comando.Parameters.Add(new SqlParameter("@COD_ORDEN", SqlDbType.Int));


                comando.Parameters[0].Value = codorden;



                IDbDataAdapter da = new SqlDataAdapter((SqlCommand)comando);
                DataSet ds = new DataSet();
                da.Fill(ds);

                return ds.Tables[0];



            }
            catch (Exception exc)
            {
                throw exc;
            }
        }

        public DataTable SEL_Detalle_Estructural(SqlCommand comando, int codOrden)
        {
            try
            {
                string sp = "SP_SEL_DetalleEstructuralByOrden";

                comando.CommandType = CommandType.StoredProcedure;
                comando.CommandText = sp;
                comando.Parameters.Clear();

                comando.Parameters.Add(new SqlParameter("@DETORDEST_CODORDEN", SqlDbType.Int));
                comando.Parameters[0].Value = codOrden;



                IDbDataAdapter da = new SqlDataAdapter((SqlCommand)comando);
                DataSet ds = new DataSet();
                da.Fill(ds);

                return ds.Tables[0];

            }
            catch (Exception exc)
            {
                throw exc;
            }
        }
    }
}
